#include "pika_config.h"
#include "pikaScript.h"

int main()
{
    // pika_platform_thread_mutex_t* m = pikaMalloc(sizeof(pika_platform_thread_mutex_t));
    // pika_platform_thread_mutex_init(m);

    // pika_platform_thread_mutex_destroy(m);
    // pikaFree(m, sizeof(pika_platform_thread_mutex_t));
    #if 1
    PikaObj* pikaMain = pikaScriptInit();
    #endif

    #if 0
    // 示例：加载单个字节码文件
    // PikaObj *pikaMain = newRootObj("pikaMain", New_PikaMain);
    // pikaVM_runBytecodeFile(pikaMain, "pikascript-api/main.py.o");
    #endif

    #if 0
    // 示例：加载字节码库并启动指定字节码
    PikaObj *pikaMain = newRootObj("pikaMain", New_PikaMain);
    obj_linkLibraryFile(pikaMain, "pikaModules.py.a");

    // 启动字节码库中的特定字节码
    obj_runModule(pikaMain, "main");
    #endif

}



#if 0
#include "ftp_client.h"

int main() {
    const char *hostname = "103.215.44.167";
    const char *username = "ftpsendi";
    const char *password = "gzsendi!@#$";
    const char *remote_filename = "DZGP/TEST1/CFG/DZGP_CFG_V20000.sd";
    const char *local_filename = "DZGP_CFG_V20000.sd";
    int sockfd = connect_to_ftp_server(hostname, FTP_PORT);
    printf("%s", read_response(sockfd));

    login(sockfd, username, password);

    // 下载文件
    download_file(sockfd, remote_filename, local_filename);

    // 退出并关闭连接
    send_command(sockfd, "QUIT");
    printf("%s", read_response(sockfd));

    close(sockfd);
    return 0;
}
#endif